<template>
<div id="Shenghuohui">
  <div id="shenghuohuiIndex">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item :to="{ path: '/' }">系统首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/recruit' }">公开招聘</el-breadcrumb-item>
      <el-breadcrumb-item>综合统计</el-breadcrumb-item>
    </el-breadcrumb>
    <section class="wboxs">
        <el-form :inline="true" :model="filters" style="margin:10px 0 0">
          <div>
            <el-form-item label="年度">
              <el-select v-model="filters.theYear" placeholder="请选择" style="width:120px">
                <el-option label="全部" value=""></el-option>
                <el-option v-for="(item, index) in yearList" :key="index" :label="item" :value="item"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="单位">
              <el-input v-model="filters.unitName" style="width:240px" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="getList" icon="el-icon-search">查询</el-button>
            </el-form-item>
            <!-- <el-form-item>
              <el-button type="success" @click="searchPrj" icon="el-icon-s-data">分析</el-button>
            </el-form-item> -->
          </div>
        </el-form>
    </section>
    <section class="wboxd" style="margin-top:10px">
      <!-- <el-table :data="shhlist" highlight-current-row v-loading="listLoading" style="width: 100%;" :height="tableHeight" border>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column prop="theYear" label="年度" width="100" align="center">
        </el-table-column>
        <el-table-column prop="unitName" label="单位" min-width="120">
        </el-table-column>
        <el-table-column prop="unitName" label="部门" width="120" align="center">
        </el-table-column>
        <el-table-column prop="unitName" label="岗位" width="120" align="center">
        </el-table-column>
        <el-table-column prop="realname" width="100" label="姓名" align="center">
        </el-table-column>
        <el-table-column prop="sex" width="50" label="性别" align="center">
        </el-table-column>
        <el-table-column prop="idCardNo" width="120" label="身份证号" align="center">
        </el-table-column>
        <el-table-column prop="phone" width="120" label="联系电话" align="center">
        </el-table-column>
        <el-table-column prop="xl" width="100" label="学历" align="center">
        </el-table-column>
        <el-table-column prop="xw" width="100" label="学位" align="center">
        </el-table-column>
        <el-table-column prop="zy" width="150" label="专业" align="center">
        </el-table-column>
        <el-table-column prop="school" width="150" label="毕业院校">
        </el-table-column>
        <el-table-column prop="type" width="120" label="来源" align="center">
          <template slot-scope="scope"><div style="line-height:300%">应届毕业生</div></template>
        </el-table-column>
      </el-table> -->
      <el-table :data="shhlist" highlight-current-row v-loading="listLoading" style="width: 100%;" :height="tableHeight" border>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column prop="theYear" label="年度" width="60" align="center">
        </el-table-column>
        <el-table-column prop="unitName" label="单位" min-width="120" align="left">
          <template slot-scope="scope">
            <div style="margin:10px 0;">{{scope.row.unitName}}</div>
          </template>
        </el-table-column>
        <el-table-column label="实际招聘人员数" align="center">
          <el-table-column prop="countAll" width="80" label="合计" align="center" />
          <el-table-column label="来源" align="center">
            <el-table-column prop="countTheType1" width="100" label="应届毕业生" align="center" />
            <el-table-column prop="countTheType2" width="80" label="社会人员" align="center" />
          </el-table-column>
          <el-table-column label="招聘方式" align="center">
            <el-table-column prop="countRecruitmentMethod1" width="80" label="考试" align="center" />
            <el-table-column prop="countRecruitmentMethod2" width="80" label="引进" align="center" />
          </el-table-column>
          <el-table-column width="100" label="学历" align="center">
            <el-table-column prop="countEducation1" width="80" label="研究生" align="center" />
            <el-table-column prop="countEducation2" width="80" label="大学本科" align="center" />
            <el-table-column prop="countEducation3" width="80" label="大学专科" align="center" />
            <el-table-column prop="countEducation4" width="80" label="中专" align="center" />
            <el-table-column prop="countEducation5" width="100" label="高中及以下" align="center" />
          </el-table-column>
          <el-table-column width="50" label="学位" align="center">
            <el-table-column prop="countDegree1" width="80" label="博士" align="center" />
            <el-table-column prop="countDegree2" width="80" label="硕士" align="center" />
            <el-table-column prop="countDegree3" width="80" label="学士" align="center" />
          </el-table-column>
        </el-table-column>
      </el-table>
      <!-- <div class="block">
        <el-pagination :total="totalnum" :page-size="pageSize" @current-change="handleCurrentChange" :current-page="pageNum" @size-change="handleSizeChange" :page-sizes="[10, 20, 30, 50]" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
      </div> -->
    </section>
  </div>
</div>
</template>

<script>
export default {
  data () {
    return {
      filters: {
        unitName: '',
        theYear: ''
      },
      yearList: [],
      btnLoading: false,
      tableHeight: 100,
      maxId: 0,
      isAdmin: true, // 临时调整为true
      isChuzhang: false,
      editVisible: false,
      editBtnsVisible: true,
      shhlist: [],
      listLoading: false,
      totalnum: 0,
      addFormVisible: false, // 新增界面是否显示
      addLoading: false,
      // 新增界面数据
      addForm: {
        Name: '',
        TheYear: ''
      },
      addFormRules: {
        Name: [
          { required: true, message: '请输入标题', trigger: 'blur' }
        ],
        TheYear: [
          { required: true, message: '请选择年度', trigger: 'blur' }
        ]
      },
      editFormRules: {
        Name: [
          { required: true, message: '请输入标题', trigger: 'blur' }
        ],
        TheYear: [
          { required: true, message: '请选择年度', trigger: 'blur' }
        ]
      },
      editFormVisible: false, // 编辑界面是否显示
      editLoading: false,
      // 编辑界面数据
      editForm: {
        Name: '',
        TheYear: '',
        Id: 0
      }
    }
  },
  methods: {
    // 获取用户列表
    getList () {
      this.listLoading = true
      let para = {
        theYear: this.filters.theYear, unitName: this.filters.unitName
      }
      this.$http
        .post(this.$http.defaults.recruitAPI + `api/recruitBusCandidateRegistration/getStat`, para)
        .then(response => {
          this.listLoading = false
          if (response.data.success === true) {
            console.log('获取成功')
            // this.shhlist = response.data.result
            this.shhlist = response.data.result
          } else {
            console.log('获取失败:' + response.data.Msg)
            this.$message({
              message: '获取失败:' + response.data.Msg,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.listLoading = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
    },
    tableresize (obj) {
      var clientHeight = 0
      if (document.body.clientHeight && document.documentElement.clientHeight) {
        clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
      } else {
        clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
      }
      obj.$nextTick(function () {
        obj.tableHeight = clientHeight - 242
      })
    }
  },
  mounted () {
    let yeararr = []
    let year = new Date().getFullYear() + 1
    for (let i = 0; i < 10; i++) {
      year = year - 1
      yeararr.push(year)
    }
    this.yearList = yeararr
    this.getList()
    this.tableresize(this)
    let _this = this
    window.onresize = function windowResize () {
      // 通过捕获系统的onresize事件触发我们需要执行的事件
      _this.tableresize(_this)
    }
  }
}
</script>
<style>
  .wboxd .el-table th{
    font-weight: normal;
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
  }
  .wboxd .el-table td, .el-table th{
    padding:0;
    font-size:var(--size14) !important;
    line-height: 20px;
    font-family: '宋体'
  }
  .tableth{
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
    height:33px;
  }
  #testlist .wboxs{
    height:45px;
    padding-top:10px;
  }
  .el-table--border th, .el-table--border td {
    border-right: 1px solid #95B8E7;
  }
  .el-table th.is-leaf, .el-table td {
    border-bottom: 1px solid #95B8E7;
  }
  #Shenghuohui .el-table td{
    border-right: 1px solid #95B8E7;
    border-bottom: 1px solid #95B8E7;
  }

</style>
<style scoped>
  #shenghuohuiIndex h1{
    font-size:var(--size16) !important;
    font-weight: bolder;
    height: 30px;
    border-bottom: 1px solid #95B8E7;
    font-family: '宋体';
    line-height: 30px;
    color: #000;
    padding-left:10px;
    background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
    margin:0;
  }
  #shenghuohuiIndex .el-pagination{
    float: left;
    padding:7px 10px;
  }
  #shenghuohuiIndex .wboxs{
    padding:5px 15px;
    width: calc(100% - 30px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
  #shenghuohuiIndex .wboxd{
    padding:0;
    width: calc(100% - 0px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
</style>
